<template>
  <div class="page_root" :key="queryUpdateFlag" data-page-name="工厂信息" data-page-identification="l_ze38swevzd">
    <a-spin :spinning="pageLoading.loading" :tip="pageLoading.tip">
      <!-- begin vid_d223as2zjp 自定义模板_fbrkow14yq -->
      <!--            设置任务-->
      <a-modal
        title="建模任务配置"
        :visible="factoryState.setVisible"
        centered
        :mask-closable="false"
        width="800px"
        @ok="confirmSet"
        @cancel="cancelSet"
        :ok-button-props="{ loading: factoryState.setLoading }"
      >
        <div class="sc-form">
          <div class="title-factory" style="margin-bottom: 10px"> 窑/熟料</div>
          <a-row>
            <a-col :span="24">
              <a-form-item label="主流程任务名称">
                <a-select
                  show-search
                  v-model:value="factoryState.yTask1"
                  :options="factoryState.taskList1"
                  :filterOption="
                                        (input, option) => {
                                            return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0
                                        }
                                    "
                /> </a-form-item
            ></a-col>
            <a-col :span="24">
              <a-form-item label="全品种任务名称">
                <a-select
                  show-search
                  v-model:value="factoryState.yTask2"
                  :options="factoryState.taskList2"
                  :filterOption="
                                        (input, option) => {
                                            return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0
                                        }
                                    "
                />
              </a-form-item>
            </a-col>
          </a-row>
          <div class="title-factory" style="margin-bottom: 10px"> 水泥磨/水泥品种</div>
          <a-row>
            <a-col :span="24">
              <a-form-item label="主流程任务名称">
                <a-select
                  show-search
                  v-model:value="factoryState.sTask1"
                  :options="factoryState.taskList1"
                  :filterOption="
                                        (input, option) => {
                                            return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0
                                        }
                                    "
                /> </a-form-item
            ></a-col>
            <a-col :span="24">
              <a-form-item label="全品种任务名称">
                <a-select
                  show-search
                  v-model:value="factoryState.sTask2"
                  :options="factoryState.taskList2"
                  :filterOption="
                                        (input, option) => {
                                            return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0
                                        }
                                    "
                />
              </a-form-item>
            </a-col>
          </a-row>
        </div>
      </a-modal>
      <!--            设置任务-->
      <!--            生成-->
      <a-modal title="生成" :visible="factoryState.scVisible" centered :mask-closable="false" width="800px" @ok="confirmSc" @cancel="cancelSc" :ok-button-props="{ loading: scLoading }">
        <div class="top-tip"
          ><ExclamationCircleFilled class="tip-img" /> 主流程默认不建立子任务，仅在数据看板展示数据关系；<br />
          全品种专项默认建立子任务，并在数据看板展示数据关系；
        </div>
        <div class="sc-form">
          <a-form-item label="所属任务">
            <a-select
              v-model:value="factoryState.groupTask"
              :options="factoryState.groupTaskList"
              @focus="getGroupTask"
              mode="multiple"
              :filterOption="
                                (input, option) => {
                                    return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0
                                }
                            "
            />
          </a-form-item>
        </div>
        <div class="title-factory"> 窑/熟料</div>
        <div class="factory-table">
          <a-table
            :columns="scColumns1"
            row-key="id"
            :data-source="factoryState.relazioneData1"
            bordered
            :row-selection="{
                            selectedRowKeys: factoryState.checkList1,
                            onChange: onSelectChange1,
                            fixed: true
                        }"
            :loading="gxLoading"
            :pagination="false"
          />
        </div>
        <div class="title-factory"> 水泥磨/水泥品种</div>
        <div class="factory-table">
          <a-table
            :columns="scColumns2"
            :loading="gxLoading"
            :data-source="factoryState.relazioneData2"
            bordered
            row-key="id"
            :pagination="false"
            :row-selection="{
                            selectedRowKeys: factoryState.checkList2,
                            onChange: onSelectChange2,
                            fixed: true
                        }"
          />
        </div>
      </a-modal>
      <!--            生成-->
      <!--            新建窑关系-->
      <a-modal :visible="factoryState.yVisible" centered :mask-closable="false" title="新建窑关系" @cancel="cancelYgx" @ok="confirmYgx" :ok-button-props="{ loading: yLoading }">
        <div class="y-form">
          <a-form :model="factoryState.gxFormData">
            <a-row>
              <template v-for="(item, index) in factoryState.gxFormData.ygxList" :key="index">
                <a-col :span="22">
                  <a-form-item label="窑名称">
                    <a-select
                      show-search
                      :options="getYlist()"
                      :filterOption="
                                                (input, option) => {
                                                    return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0
                                                }
                                            "
                      v-model:value="factoryState.gxFormData.ygxList[index].lineId"
                      placeholder="请输入"
                    />
                  </a-form-item>
                </a-col>
                <a-col :span="2">
                  <a-button type="link" @click="handlerDeleteGx('ygxList', index)">删除</a-button>
                </a-col>
                <a-col :span="22">
                  <a-form-item label="对应熟料">
                    <a-select
                      show-search
                      :options="getslList()"
                      :filterOption="
                                                (input, option) => {
                                                    return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0
                                                }
                                            "
                      v-model:value="factoryState.gxFormData.ygxList[index].varietyId"
                      placeholder="请输入"
                    />
                  </a-form-item>
                </a-col>
                <a-col :span="22">
                  <a-form-item label="是否验收品种">
                    <a-select
                      :options="[
                                                {
                                                    label: '是',
                                                    value: '是'
                                                },
                                                {
                                                    label: '否',
                                                    value: '否'
                                                }
                                            ]"
                      v-model:value="factoryState.gxFormData.ygxList[index].checkVariety"
                      placeholder="请输入"
                    />
                  </a-form-item>
                </a-col>
              </template>
              <a-col :span="24">
                <a-button type="primary" ghost @click="handleAddYitem('ygxList')">新建</a-button>
              </a-col>
            </a-row>
          </a-form>
        </div>
      </a-modal>
      <!--            新建窑关系-->
      <!--            新建水泥磨关系-->
      <a-modal :visible="factoryState.sVisible" centered :mask-closable="false" title="新建水泥磨关系" @cancel="cancelSgx" @ok="confirmSgx" :ok-button-props="{ loading: sLoading }">
        <div class="y-form">
          <a-form :model="factoryState.gxFormData">
            <a-row>
              <template v-for="(item, index) in factoryState.gxFormData.snmList" :key="index">
                <a-col :span="22">
                  <a-form-item label="水泥磨名称">
                    <a-select
                      show-search
                      :options="getSnmList()"
                      :filterOption="
                                                (input, option) => {
                                                    return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0
                                                }
                                            "
                      v-model:value="factoryState.gxFormData.snmList[index].lineId"
                      placeholder="请输入"
                    />
                  </a-form-item>
                </a-col>
                <a-col :span="2">
                  <a-button type="link" @click="handlerDeleteGx('snmList', index)">删除</a-button>
                </a-col>
                <a-col :span="22">
                  <a-form-item label="对应水泥品种">
                    <a-select
                      show-search
                      :options="getSnpzList()"
                      :filterOption="
                                                (input, option) => {
                                                    return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0
                                                }
                                            "
                      v-model:value="factoryState.gxFormData.snmList[index].varietyId"
                      placeholder="请输入"
                    />
                  </a-form-item>
                </a-col>
                <a-col :span="22">
                  <a-form-item label="是否验收品种">
                    <a-select
                      :options="[
                                                {
                                                    label: '是',
                                                    value: '是'
                                                },
                                                {
                                                    label: '否',
                                                    value: '否'
                                                }
                                            ]"
                      v-model:value="factoryState.gxFormData.snmList[index].checkVariety"
                      placeholder="请输入"
                    />
                  </a-form-item>
                </a-col>
              </template>
              <a-col :span="24">
                <a-button type="primary" ghost @click="handleAddMitem('snmList')">新建</a-button>
              </a-col>
            </a-row>
          </a-form>
        </div>
      </a-modal>
      <!--            新建水泥磨关系-->
      <a-modal
        :visible="factoryState.addVisible"
        title="新建"
        centered
        :body-style="{
                    maxHeight: '680px',
                    overflowY: 'auto',
                    paddingBottom: '0'
                }"
        @ok="submitAddFactory"
        @cancel="cancelAddFactory"
        :ok-button-props="{ loading: factoryState.addLoading }"
      >
        <a-form :model="factoryState.formData">
          <div class="factory-my-page">
            <div class="factory-module-item" v-for="(item, index) in factoryState.formData.yList" :key="index">
              <div class="factory-form-content">
                <a-form-item label="窑" :rules="[{ required: false }, { validator: validateYName, trigger: 'blur' }]" :name="['yList', index, 'name']">
                  <a-col :span="24">
                    <a-select
                      :options="factoryState.ySelectList"
                      :filterOption="
                                                (input, option) => {
                                                    return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0
                                                }
                                            "
                      v-model:value="factoryState.formData.yList[index].name"
                      placeholder="请输入"
                    />
                  </a-col>
                </a-form-item>
              </div>

              <a class="factory-add-btn" @click="addFactoryItem('yList', index, '窑')">新建</a>
              <a class="factory-del" @click="handlerDeleteFactoryItem('yList', index)">删除</a>
            </div>
            <div class="factory-module-item" v-for="(item, index) in factoryState.formData.slList" :key="index">
              <div class="factory-form-content">
                <a-form-item label="熟料品种" :rules="[{ required: false }, { validator: validateSlName, trigger: 'blur' }]" :name="['slList', index, 'name']">
                  <a-col :span="24">
                    <a-input v-model:value="factoryState.formData.slList[index].name" placeholder="请输入" />
                  </a-col>
                </a-form-item>
              </div>

              <a class="factory-add-btn" @click="addFactoryItem('slList', index, '熟料品种')">新建</a>
              <a class="factory-del" @click="handlerDeleteFactoryItem('slList', index)">删除</a>
            </div>
            <div class="factory-module-item" v-for="(item, index) in factoryState.formData.snList" :key="index">
              <div class="factory-form-content">
                <a-form-item label="水泥磨" :rules="[{ required: false }, { validator: validateSnName, trigger: 'blur' }]" :name="['snList', index, 'name']">
                  <a-col :span="24">
                    <a-select
                      :filterOption="
                                                (input, option) => {
                                                    return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0
                                                }
                                            "
                      :options="factoryState.mSelectList"
                      v-model:value="factoryState.formData.snList[index].name"
                      placeholder="请输入"
                    />
                  </a-col>
                </a-form-item>
              </div>

              <a class="factory-add-btn" @click="addFactoryItem('snList', index, '水泥磨')">新建</a>
              <a class="factory-del" @click="handlerDeleteFactoryItem('snList', index)">删除</a>
            </div>
            <div class="factory-module-item" v-for="(item, index) in factoryState.formData.pzList" :key="index">
              <div class="factory-form-content">
                <a-form-item label="水泥品种" :rules="[{ required: false }, { validator: validatePzName, trigger: 'blur' }]" :name="['pzList', index, 'name']">
                  <a-col :span="24">
                    <a-input v-model:value="factoryState.formData.pzList[index].name" placeholder="请输入" />
                  </a-col>
                </a-form-item>
              </div>

              <a class="factory-add-btn" @click="addFactoryItem('pzList', index, '水泥品种')">新建</a>
              <a class="factory-del" @click="handlerDeleteFactoryItem('pzList', index)">删除</a>
            </div>
          </div>
        </a-form>
      </a-modal>
      <a-modal
        :visible="factoryState.editVisible"
        title="编辑"
        centered
        :body-style="{
                    maxHeight: '680px',
                    overflowY: 'auto'
                }"
        @ok="submitEditFactory"
        @cancel="cancelEditFactory"
        :ok-button-props="{ loading: factoryState.editLoading }"
      >
        <a-form :model="currentFactoryData" ref="editFactoryRef">
          <a-form-item :label="currentFactoryData.componentType" :rules="[{ required: true, trigger: 'blur' }]" name="componentName">
            <a-col :span="24">
              <a-input v-model:value="currentFactoryData.componentName" placeholder="请输入" />
            </a-col>
          </a-form-item>
        </a-form>
      </a-modal>
      <div class="factory-body">
        <div class="top-flex">
          <a-radio-group v-model:value="factoryState.radioValue" button-style="solid" @change="radioChange">
            <a-radio-button value="数据列表">数据列表</a-radio-button>
            <a-radio-button value="数据关系">数据关系</a-radio-button>
          </a-radio-group>
          <a-space>
            <a-button type="primary" v-if="factoryState.radioValue === '数据关系'" @click="handleGenerate">生成</a-button>
            <a-button type="primary" v-if="factoryState.radioValue === '数据关系'" @click="handleSetTask">建模任务配置</a-button>
          </a-space>
        </div>

        <a-spin :spinning="factoryState.factoryLoading" tip="加载中">
          <div class="factory-top">
            <div class="title-factory"> {{ factoryState.radioValue === '数据列表' ? '窑列表' : '窑/熟料' }}</div>
            <a-space :size="16">
              <!--                      <a-button type="primary" @click="handleSettingFactory">生成</a-button>-->
              <a-button type="primary" v-if="factoryState.radioValue === '数据列表'" @click="handleAddFactoryForm" ghost>新建</a-button>
              <a-button type="primary" v-else @click="handleAddYgx" class="qian" ghost>新建窑关系</a-button>
            </a-space>
          </div>
          <template v-if="factoryState.radioValue === '数据列表'">
            <div class="factory-table">
              <a-table bordered :columns="yColumns" :data-source="factoryState.yData" :pagination="false">
                <template #bodyCell="{ record, text, column, index }">
                  <template v-if="column.dataIndex === 'opration'">
                    <a-space>
                      <a-button type="link" @click="handleEditFactoryRecord(record)">编辑</a-button>
                      <a-popconfirm @confirm="handleDeleteFactoryRecord(record)" title="确定删除吗？">
                        <a-button type="link">删除</a-button>
                      </a-popconfirm>
                    </a-space>
                  </template>
                </template>
              </a-table>
            </div>
            <div class="title-factory"> 熟料列表 </div>
            <div class="factory-table">
              <a-table bordered :columns="slColumns" :data-source="factoryState.slData" :pagination="false">
                <template #bodyCell="{ record, text, column, index }">
                  <template v-if="column.dataIndex === 'opration'">
                    <a-space>
                      <a-button type="link" @click="handleEditFactoryRecord(record)">编辑</a-button>
                      <a-popconfirm @confirm="handleDeleteFactoryRecord(record)" title="确定删除吗？">
                        <a-button type="link">删除</a-button>
                      </a-popconfirm>
                    </a-space>
                  </template>
                </template>
              </a-table>
            </div>
            <div class="title-factory"> 水泥磨列表 </div>
            <div class="factory-table">
              <a-table bordered :columns="snColumns" :data-source="factoryState.snData" :pagination="false">
                <template #bodyCell="{ record, text, column, index }">
                  <template v-if="column.dataIndex === 'opration'">
                    <a-space>
                      <a-button type="link" @click="handleEditFactoryRecord(record)">编辑</a-button>
                      <a-popconfirm @confirm="handleDeleteFactoryRecord(record)" title="确定删除吗？">
                        <a-button type="link">删除</a-button>
                      </a-popconfirm>
                    </a-space>
                  </template>
                </template>
              </a-table>
            </div>
            <div class="title-factory"> 水泥品种列表 </div>
            <div class="factory-table">
              <a-table bordered :columns="pzColumns" :data-source="factoryState.pzData" :pagination="false">
                <template #bodyCell="{ record, text, column, index }">
                  <template v-if="column.dataIndex === 'opration'">
                    <a-space>
                      <a-button type="link" @click="handleEditFactoryRecord(record)">编辑</a-button>
                      <a-popconfirm @confirm="handleDeleteFactoryRecord(record)" title="确定删除吗？">
                        <a-button type="link">删除</a-button>
                      </a-popconfirm>
                    </a-space>
                  </template>
                </template>
              </a-table>
            </div>
          </template>
          <template v-else>
            <div class="factory-table">
              <a-table bordered :columns="relazioneColumns1" :data-source="factoryState.relazioneData1" :pagination="false" :loading="gxLoading">
                <template #bodyCell="{ record, text, column, index }">
                  <template v-if="column.dataIndex === 'count'">
                    {{ index + 1 }}
                  </template>
                  <template v-if="column.dataIndex === 'opration'">
                    <a-space>
                      <a-popconfirm @confirm="deleteGx(record)" title="确定删除吗？">
                        <a-button type="link">删除</a-button>
                      </a-popconfirm>
                    </a-space>
                  </template>
                </template>
              </a-table>
            </div>
            <div class="title-factory">
              水泥磨/水泥品种
              <a-button type="primary" @click="handleAddSngx" class="qian" ghost>新建水泥磨关系</a-button></div
            >
            <div class="factory-table">
              <a-table bordered :columns="relazioneColumns2" :data-source="factoryState.relazioneData2" :pagination="false" :loading="gxLoading">
                <template #bodyCell="{ record, text, column, index }">
                  <template v-if="column.dataIndex === 'count'">
                    {{ index + 1 }}
                  </template>
                  <template v-if="column.dataIndex === 'opration'">
                    <a-space>
                      <a-popconfirm @confirm="deleteGx(record)" title="确定删除吗？">
                        <a-button type="link">删除</a-button>
                      </a-popconfirm>
                    </a-space>
                  </template>
                </template>
              </a-table>
            </div>
          </template>
        </a-spin>
      </div>
      <!-- end vid_d223as2zjp 自定义模板_fbrkow14yq -->
      <!-- begin vid_9dwjk5bbll 容器_gt8wmeclfn -->
      <al-box v-if="false" class="vid_9dwjk5bbll">
        <!-- begin vid_h7skca6kvk 生成 -->
        <a-button v-permission="'3000001001_vid_h7skca6kvk'" class="vid_h7skca6kvk"> 生成 </a-button>
        <!-- end vid_h7skca6kvk 生成 -->
        <!-- begin vid_eln1jjdsdj 新建 -->
        <a-button v-permission="'3000001001_vid_eln1jjdsdj'" class="vid_eln1jjdsdj"> 新建 </a-button>
        <!-- end vid_eln1jjdsdj 新建 -->
        <!-- begin vid_7phmmyo89j 新建窑关系 -->
        <a-button v-permission="'3000001001_vid_7phmmyo89j'" class="vid_7phmmyo89j"> 新建窑关系 </a-button>
        <!-- end vid_7phmmyo89j 新建窑关系 -->
        <!-- begin vid_88rtnv1o7y 新建水泥磨关系 -->
        <a-button v-permission="'3000001001_vid_88rtnv1o7y'" class="vid_88rtnv1o7y"> 新建水泥磨关系 </a-button>
        <!-- end vid_88rtnv1o7y 新建水泥磨关系 -->
        <!-- begin vid_ysgrywvtou 建模任务配置 -->
        <a-button v-permission="'3000001001_vid_ysgrywvtou'" class="vid_ysgrywvtou"> 建模任务配置 </a-button>
        <!-- end vid_ysgrywvtou 建模任务配置 -->
      </al-box>
      <!-- end vid_9dwjk5bbll 容器_gt8wmeclfn -->
    </a-spin>
  </div>
</template>
<script setup lang="tsx">
  import {
      h, ref, reactive, toRaw, markRaw, watch, computed,
      onBeforeMount, onMounted, onBeforeUnmount, onUnmounted, onActivated, onDeactivated
    } from "vue";
    import { useRoute, useRouter } from 'vue-router';
    const router = useRouter();
    const route = useRoute();
    import { get, post, put, del, request, requestWithHeaders } from '@/utils/http/Axios';
    import { cloneDeep, localGet, merge, getDifferenceArray, traversalTreeStructure, checkCaseCondition, renderStringInTemplate, handleBreadcrumbJump, throttle, permission, getComponentParamsValue } from '@/utils/index';
    import { isNullOrEmpty, isEmptyArr, isNullOrUnDef, isContained, isArray, isEmpty, isObject } from '@/utils/is';
    import dayjs from 'dayjs';
    import { getPagePcChartsDataSourceConvert } from '@/utils/chart';
    import { message, notification, Modal } from 'ant-design-vue'
    import { propertyFormatByNumber, propertyFormatByPercentage, propertyFormatByDate, parseSubFromDataList } from '@/utils/format';
    import colorTheme from '@/design/custom-theme.json';
    
    import UserTableRecords from '@/model/UserTableRecords';
    import { getAppBaseUrl } from '@/utils/index';
    import { sendToken } from "@/hooks/useIframeToken";
    import { useSystemStore } from "@/store/modules/system";
    const systemStore = useSystemStore();
    



      // 获取传入的流程ID和组件参数
      const props = defineProps({
            'processInstanceId': {
            type: [String,Number,Boolean],
            default: undefined,
        },
      'projectId': {
            type: [String,Number],
            default: undefined,
        },
      })
      const immediateWatch = (source, callback) => {
        watch(source, callback, {deep: true,immediate: true })
      }



  /* -------------------------- 属性定义 -------------------------- */

      const setTimeOutList = [];
      const pageLoading = reactive({
        loading: false,
        tip: undefined
      });
      const authInfo = localGet('app-user-store');




      // 处理校验
      const setSubFormName =(parentInfo, name)=>{
        return [parentInfo.parents, parentInfo.cycleIndex, name];
      }


  /* ========================== 属性定义 ========================== */


  /* -------------------------- 元素数据引用 -------------------------- */


  /* ========================== 元素数据引用 ========================== */


  /* -------------------------- 页面数据 -------------------------- */


  /* ========================== 页面数据 ========================== */



  /* -------------------------- 响应 -------------------------- */

  /* ========================== 响应 ========================== */


  /* -------------------------- 函数 -------------------------- */

  /* ========================== 函数 ========================== */


  /* -------------------------- 页面参数 -------------------------- */

    const pageParameter_state = reactive({
        'processInstanceId': props.processInstanceId ?? route.query.processInstanceId,
    })

  /* ========================== 页面参数 ========================== */


  /* -------------------------- 组件事件处理方法 -------------------------- */

    // ---------------------------- 组件数据同步 ----------------------------

    // ============================ 组件数据同步 ============================


  /* ========================== 组件事件处理方法 ========================== */


  /* -------------------------- 生命周期 -------------------------- */
  // 用于参数变更后重新执行自定义指令
      const queryUpdateFlag = ref(0);
      onMounted(() => { ;

    });

    onUnmounted(() => {
      // 销毁定时器
      setTimeOutList.forEach(({ repeat, timer }) => {
        repeat ?  clearInterval(timer): clearTimeout(timer);
      });
    });

  /* ========================== 生命周期 ========================== */


  /* -------------------------- 数据关联处理 -------------------------- */





  /* -------------------------- 表单数据同步 -------------------------- */
  /* ========================== 表单数据同步 ========================== */

  /* ========================== 数据关联处理 ========================== */


  /* -------------------------- 不同组件自定义的处理逻辑 -------------------------- */

  /* ========================== 不同组件自定义的处理逻辑 ========================== */


  // ================================定制化逻辑========================================
  const { projectId } = props

      //工厂信息
      const factoryState = reactive({
          yData: [],
          slData: [],
          snData: [],
          pzData: [],
          mSelectList: [],
          ySelectList: [],
          // 对应熟料
          slSelectList: [],
          // 对应水泥品种
          snSelectList: [],
          addVisible: false,
          editVisible: false,
          addLoading: false,
          editLoading: false,
          factoryLoading: false,
          formData: {
              yList: [{ cementPlantComponentType: '窑', name: undefined }],
              slList: [{ cementPlantComponentType: '熟料品种', name: undefined }],
              snList: [{ cementPlantComponentType: '水泥磨', name: undefined }],
              pzList: [{ cementPlantComponentType: '水泥品种', name: undefined }]
          },
          relazioneData1: [],
          relazioneData2: [],
          radioValue: '数据列表',
          gxFormData: {
              ygxList: [],
              snmList: []
          },
          yVisible: false,
          sVisible: false,
          scVisible: false,

          groupTask: [],
          taskType: '',
          groupTaskList: [],
          scData1: [],
          scData2: [],
          checkList1: [],
          checkList2: [],
          setVisible: false,
          taskList1: [],
          taskList2: [],
          setLoading: false,
          yTask1: undefined,
          yTask2: undefined,
          sTask1: undefined,
          sTask2: undefined
      })
      const scColumns1 = ref([
          {
              title: '窑名称',
              dataIndex: 'lineName',
              align: 'center'
          },
          {
              title: '熟料品种名称',
              dataIndex: 'vaietyName',
              align: 'center'
          }
      ])
      const scColumns2 = ref([
          {
              title: '水泥磨名称',
              dataIndex: 'lineName',
              align: 'center'
          },
          {
              title: '水泥磨品种名称',
              dataIndex: 'vaietyName',
              align: 'center'
          }
      ])
      const currentFactoryData = ref()
      const validateYName = (rule, value, callback) => {
          // 如果 value 为空，跳过重复校验
          if (!value) {
              return Promise.resolve()
          }
          const arr = factoryState.formData.yList.filter(item => item.name === value)
          if (arr.length > 1) {
              return Promise.reject('窑不能重复！')
          } else {
              return Promise.resolve()
          }
      }
      const validateSlName = (rule, value, callback) => {
          // 如果 value 为空，跳过重复校验
          if (!value) {
              return Promise.resolve()
          }
          const arr = factoryState.formData.slList.filter(item => item.name === value)
          if (arr.length > 1) {
              return Promise.reject('熟料品种不能重复！')
          } else {
              return Promise.resolve()
          }
      }
      const validateSnName = (rule, value, callback) => {
          // 如果 value 为空，跳过重复校验
          if (!value) {
              return Promise.resolve()
          }
          const arr = factoryState.formData.snList.filter(item => item.name === value)
          if (arr.length > 1) {
              return Promise.reject('水泥磨不能重复！')
          } else {
              return Promise.resolve()
          }
      }
      const validatePzName = (rule, value, callback) => {
          // 如果 value 为空，跳过重复校验
          if (!value) {
              return Promise.resolve()
          }
          const arr = factoryState.formData.pzList.filter(item => item.name === value)
          if (arr.length > 1) {
              return Promise.reject('水泥品种不能重复！')
          } else {
              return Promise.resolve()
          }
      }
      const yColumns = ref([
          {
              title: '窑',
              dataIndex: 'componentName',
              align: 'left',
              width: 400
          },
          {
              title: '最近操作时间',
              dataIndex: 'updateTime',
              align: 'center'
          },
          {
              title: '最近操作人',
              dataIndex: 'updateBy',
              align: 'center'
          },
          {
              title: '操作',
              dataIndex: 'opration',
              width: 100,
              align: 'center'
          }
      ])
      const slColumns = ref([
          {
              title: '熟料品种',
              dataIndex: 'componentName',
              align: 'left',
              width: 400
          },
          {
              title: '最近操作时间',
              dataIndex: 'updateTime',
              align: 'center'
          },
          {
              title: '最近操作人',
              dataIndex: 'updateBy',
              align: 'center'
          },
          {
              title: '操作',
              dataIndex: 'opration',
              width: 100,
              align: 'center'
          }
      ])
      const snColumns = ref([
          {
              title: '水泥磨',
              dataIndex: 'componentName',
              align: 'left',
              width: 400
          },
          {
              title: '最近操作时间',
              dataIndex: 'updateTime',
              align: 'center'
          },
          {
              title: '最近操作人',
              dataIndex: 'updateBy',
              align: 'center'
          },
          {
              title: '操作',
              dataIndex: 'opration',
              width: 100,
              align: 'center'
          }
      ])
      const pzColumns = ref([
          {
              title: '水泥品种',
              dataIndex: 'componentName',
              align: 'left',
              width: 400
          },
          {
              title: '最近操作时间',
              dataIndex: 'createdTime',
              align: 'center'
          },
          {
              title: '最近操作人',
              dataIndex: 'updateBy',
              align: 'center'
          },
          {
              title: '操作',
              dataIndex: 'opration',
              width: 100,
              align: 'center'
          }
      ])
      const relazioneColumns1 = ref([
          {
              title: '序号',
              dataIndex: 'count',
              align: 'left',
              width: 100
          },
          {
              title: '窑名称',
              dataIndex: 'lineName',
              ellipsis: true,
              align: 'left',
              width: 120
          },
          {
              title: '熟料品种',
              dataIndex: 'vaietyName',
              ellipsis: true,
              align: 'left',
              width: 120
          },
          {
              title: '是否验收品种',
              dataIndex: 'checkVariety',
              align: 'left',
              width: 120
          },
          {
              title: '宽表积累条数',
              dataIndex: 'wideTableColumnNumber',
              align: 'left',
              width: 120
          },
          {
              title: '所属任务',
              dataIndex: 'relateTaskNames',
              ellipsis: true,
              width: 250,
              align: 'left'
          },
          {
              title: '最近操作时间',
              dataIndex: 'createdTime',
              align: 'center'
          },
          {
              title: '最近操作人',
              dataIndex: 'updateBy',
              align: 'center'
          },
          {
              title: '操作',
              dataIndex: 'opration',
              width: 100,
              align: 'center'
          }
      ])
      const relazioneColumns2 = ref([
          {
              title: '序号',
              dataIndex: 'count',
              align: 'left',
              width: 100
          },
          {
              title: '水泥磨',
              dataIndex: 'lineName',
              ellipsis: true,
              align: 'left',
              width: 120
          },
          {
              title: '水泥品种',
              dataIndex: 'vaietyName',
              ellipsis: true,
              align: 'left',
              width: 120
          },
          {
              title: '是否验收品种',
              dataIndex: 'checkVariety',
              align: 'left',
              width: 120
          },
          {
              title: '宽表积累条数',
              dataIndex: 'wideTableColumnNumber',
              align: 'left',
              width: 120
          },
          {
              title: '所属任务',
              dataIndex: 'relateTaskNames',
              align: 'left',
              ellipsis: true,
              width: 250
          },
          {
              title: '最近操作时间',
              dataIndex: 'createdTime',
              align: 'center'
          },
          {
              title: '最近操作人',
              dataIndex: 'updateBy',
              align: 'center'
          },
          {
              title: '操作',
              dataIndex: 'opration',
              width: 100,
              align: 'center'
          }
      ])
      const emit = defineEmits(['getFactoryData', 'getFactoryYselect', 'getFactoryMselect']) // 定义一个事件
      defineExpose({
          getFactoryData,
          getFactoryYselect,
          getFactoryMselect
      })
      const useProjectId = ref()
      import { watchEffect } from 'vue'
      watchEffect(() => {
          if (props.projectId) {
              setTimeout(() => {
                  useProjectId.value = props.projectId
                  getFactoryData()
                  getFactoryMselect()
                  getFactoryYselect()
                  getTaskList()
                getGxData()
              }, 500)
          }
      })
      function getFactoryData() {
          factoryState.factoryLoading = true
          get(`/solution-ppm/api/v2/built-in-system-ppm/project/factory/search/${useProjectId.value}`)
              .then(data => {
                  if (data.code !== 200) {
                      message.error(data.message)
                      return
                  }

                  // 使用一个临时对象来存储数据
                  const updatedData = {
                      yData: [],
                      slData: [],
                      snData: [],
                      pzData: []
                  }

                  // 循环遍历所有数据项
                  data.data.forEach(item => {
                      switch (item.cementPlantComponentType) {
                          case '窑':
                              updatedData.yData = [...updatedData.yData, ...item.cementPlantComponentList]
                              break
                          case '熟料品种':
                              updatedData.slData = [...updatedData.slData, ...item.cementPlantComponentList]
                              break
                          case '水泥磨':
                              updatedData.snData = [...updatedData.snData, ...item.cementPlantComponentList]
                              break
                          case '水泥品种':
                              updatedData.pzData = [...updatedData.pzData, ...item.cementPlantComponentList]
                              break
                          default:
                              break
                      }
                  })

                  // 更新到 factoryState 上
                  factoryState.yData = updatedData.yData
                  factoryState.slData = updatedData.slData
                  factoryState.snData = updatedData.snData
                  factoryState.pzData = updatedData.pzData
              })
              .finally(() => {
                  factoryState.factoryLoading = false
              })
      }
      function getFactoryYselect() {
          get(`/solution-ppm/api/v2/built-in-system-ppm/dictionary/search/GCXX.KILN`).then(data => {
              if (data.code !== 200) {
                  message.error(data.message)
                  return
              }
              factoryState.ySelectList = data.data.map(item => {
                  return {
                      label: item.itemName,
                      value: item.itemName
                  }
              })
          })
      }
      function getFactoryMselect() {
          get(`/solution-ppm/api/v2/built-in-system-ppm/dictionary/search/GCXX.RUB`).then(data => {
              if (data.code !== 200) {
                  message.error(data.message)
                  return
              }
              factoryState.mSelectList = data.data.map(item => {
                  return {
                      label: item.itemName,
                      value: item.itemName
                  }
              })
          })
      }

      function handleAddFactoryForm() {
          factoryState.addVisible = true
      }
      function handleSettingFactory() {
          post(`/solution-ppm/api/v2/built-in-system-ppm/project/factory/generate_task/${useProjectId.value}`).then(
              data => {
                  if (data.code !== 200) {
                      message.error(data.message)
                      return
                  }
                  message.success(data.message)
                  getFactoryData()
              }
          )
      }
      const factoryItem = {
          name: undefined
      }
      function addFactoryItem(name, index, type) {
          // 使用传入的 name 动态访问相应的数组
          factoryState.formData[name].push({ cementPlantComponentType: type, name: undefined }) // 添加新的空项
      }

      function handlerDeleteFactoryItem(name, index) {
          // 确保数组有多个元素时才能删除
          if (factoryState.formData[name].length === 1) {
              return
          }
          // 删除指定索引的项
          factoryState.formData[name].splice(index, 1)
      }
      const editFactoryRef = ref(null)
      function submitAddFactory() {
          const formattedData = formatFactoryData(factoryState.formData)
          factoryState.addLoading = true
          post(
              `/solution-ppm/api/v2/built-in-system-ppm/project/factory/batch_create/${useProjectId.value}`,
              formattedData
          )
              .then(data => {
                  if (data.code !== 200) {
                      message.error(data.message)
                      return
                  }
                  message.success(data.message)

                  cancelAddFactory()
                  getFactoryData()
              })
              .finally(() => {
                  factoryState.addLoading = false
              })
      }
      function cancelAddFactory() {
          factoryState.addVisible = false
          factoryState.formData = {
              yList: [{ cementPlantComponentType: '窑', name: undefined }],
              slList: [{ cementPlantComponentType: '熟料品种', name: undefined }],
              snList: [{ cementPlantComponentType: '水泥磨', name: undefined }],
              pzList: [{ cementPlantComponentType: '水泥品种', name: undefined }]
          }
      }
      function submitEditFactory() {
          editFactoryRef.value
              .validate()
              .then(() => {
                  factoryState.editLoading = true
                  put('/solution-ppm/api/v2/built-in-system-ppm/project/factory', currentFactoryData.value).then(data => {
                      if (data.code !== 200) {
                          message.error(data.message)
                          return
                      }
                      message.success(data.message)
                      factoryState.editVisible = false
                      getFactoryData()
                  })
              })
              .finally(() => {
                  factoryState.editLoading = false
              })
      }
      function cancelEditFactory() {
          factoryState.editVisible = false
      }
      function handleEditFactoryRecord(record) {
          const sameData = cloneDeep(record)
          const { id, componentName, componentType, ...oldData } = sameData
          currentFactoryData.value = {
              id,
              componentName,
              componentType
          }
          factoryState.editVisible = true
      }
      function handleDeleteFactoryRecord(record) {
          del(`/solution-ppm/api/v2/built-in-system-ppm/project/factory/${record.id}`).then(data => {
              if (data.code !== 200) {
                  message.error(data.message)
                  return
              }
              message.success(data.message)
              getFactoryData()
          })
      }
      function deleteGx(record) {
          del(`/solution-ppm/api/v2/built-in-system-ppm/project/factory/relation/${record.id}`).then(data => {
              if (data.code !== 200) {
                  message.error(data.message)
                  return
              }
              message.success(data.message)
              getGxData()
          })
      }
      function formatFactoryData(inputData) {
          const result = []
          const categories = ['yList', 'slList', 'snList', 'pzList']

          categories.forEach(category => {
              inputData[category].forEach(item => {
                  // Check if the type already exists in the result array
                  const existingCategory = result.find(
                      group => group.cementPlantComponentType === item.cementPlantComponentType
                  )
                  if (existingCategory) {
                      existingCategory.cementPlantComponentList.push(item.name)
                  } else {
                      // If the type doesn't exist, create a new group
                      result.push({
                          cementPlantComponentType: item.cementPlantComponentType,
                          cementPlantComponentList: [item.name]
                      })
                  }
              })
          })

          return result
      }
      function handleAddYgx() {
          factoryState.yVisible = true
          factoryState.gxFormData.ygxList = [
              {
                  type: '窑',
                  lineId: undefined,
                  varietyId: undefined,
                  projectId: useProjectId.value,
                  checkVariety: '否'
              }
          ]
      }
      function handleAddSngx() {
          factoryState.sVisible = true
          factoryState.gxFormData.snmList = [
              {
                  type: '磨',
                  varietyId: undefined,
                  varietyId: undefined,
                  projectId: useProjectId.value,
                  checkVariety: '否'
              }
          ]
      }
      function cancelYgx() {
          factoryState.yVisible = false
          factoryState.gxFormData.ygxList = [
              {
                  type: '窑',
                  lineId: undefined,
                  varietyId: undefined,
                  projectId: useProjectId.value,
                  checkVariety: '否'
              }
          ]
      }
      function validateCheckVariety() {
          const yesCount = factoryState.gxFormData.ygxList.filter(item => item.checkVariety === '是').length
          if (yesCount > 1) {
              message.error('工厂下的数据关系验收品种为是的不能超过1个')
              return false
          }
          return true
      }
      function validateCheckS() {
          const yesCount = factoryState.gxFormData.snmList.filter(item => item.checkVariety === '是').length
          if (yesCount > 1) {
              message.error('工厂下的数据关系验收品种为是的不能超过1个')
              return false
          }
          return true
      }
      function confirmYgx() {
          const isValid = validateCheckVariety()
          if (!isValid) return
          sLoading.value = true
          post(
              '/solution-ppm/api/v2/built-in-system-ppm/project/factory/relation/create',
              factoryState.gxFormData.ygxList
          )
              .then(data => {
                  if (data.code !== 200) {
                      message.error(data.message)
                      return
                  }
                  message.success(data.message)
                  cancelYgx()
                  getGxData()
              })
              .finally(() => {
                  sLoading.value = false
              })
      }
      function cancelSgx() {
          factoryState.gxFormData.snmList = [
              {
                  type: '磨',
                  varietyId: undefined,
                  varietyId: undefined,
                  projectId: useProjectId.value,
                  checkVariety: '否'
              }
          ]
          factoryState.sVisible = false
      }
      const sLoading = ref(false)
      const yLoading = ref(false)
      function confirmSgx() {
          const isValid = validateCheckS()
          if (!isValid) return
          sLoading.value = true
          post(
              '/solution-ppm/api/v2/built-in-system-ppm/project/factory/relation/create',
              factoryState.gxFormData.snmList
          )
              .then(data => {
                  if (data.code !== 200) {
                      message.error(data.message)
                      return
                  }
                  message.success(data.message)
                  cancelSgx()
                  getGxData()
              })
              .finally(() => {
                  sLoading.value = false
              })
      }

      function handleAddYitem() {
          const item = {
              type: '窑',
              lineId: undefined,
              varietyId: undefined,
              checkVariety: '否',
              projectId: useProjectId.value
          }
          factoryState.gxFormData.ygxList.push(item) // 添加新的空项
      }
      function handleAddMitem() {
          const item = {
              type: '磨',
              lineId: undefined,
              varietyId: undefined,
              checkVariety: '否',
              projectId: useProjectId.value
          }
          factoryState.gxFormData.snmList.push(item) // 添加新的空项
      }
      function handlerDeleteGx(name, index) {
          // 确保数组有多个元素时才能删除
          if (factoryState.gxFormData[name].length === 1) {
              return
          }
          // 删除指定索引的项
          factoryState.gxFormData[name].splice(index, 1)
      }
      function handleGenerate() {
          factoryState.scVisible = true
      }
      const scLoading = ref(false)
      function confirmSc() {
          scLoading.value = true
          const params = {
              taskIdList: factoryState.groupTask,
              projectId: useProjectId.value,
              kilnIdList: factoryState.checkList1,
              gridingMillIdList: factoryState.checkList2
          }
          post('/solution-ppm/api/v2/built-in-system-ppm/project/factory/generate_task', params)
              .then(data => {
                  if (data.code !== 200) {
                      message.error(data.message)
                      return
                  }
                  message.success(data.message)
                  cancelSc()
                  getGxData()
              })
              .finally(() => {
                  scLoading.value = false
              })
      }
      function cancelSc() {
          factoryState.scVisible = false
          factoryState.groupTask = undefined
          factoryState.checkList2 = factoryState.checkList1 = []
      }
      function onSelectChange1(selectedRowKeys) {
          factoryState.checkList1 = selectedRowKeys
      }
      function onSelectChange2(selectedRowKeys) {
          factoryState.checkList2 = selectedRowKeys
      }
      // factoryState.yData = updatedData.yData
      // factoryState.slData = updatedData.slData
      // factoryState.snData = updatedData.snData
      // factoryState.pzData = updatedData.pzData
      // 获取窑名称
      function getYlist() {
          return factoryState.yData.map(item => ({
              label: item.componentName,
              value: item.id
          }))
      }
      // 获取熟料
      function getslList() {
          return factoryState.slData.map(item => ({
              label: item.componentName,
              value: item.id
          }))
      }
      // 获取水泥磨
      function getSnmList() {
          return factoryState.snData.map(item => ({
              label: item.componentName,
              value: item.id
          }))
      }
      // 获取水泥品种
      function getSnpzList() {
          return factoryState.pzData.map(item => ({
              label: item.componentName,
              value: item.id
          }))
      }
      function getGxData() {
        console.log('调关系');
          gxLoading.value = true
          post('/solution-ppm/api/v2/built-in-system-ppm/project/factory/relation/search', {
              type: '窑',
              projectId: useProjectId.value
          })
              .then(data => {
                  factoryState.relazioneData1 = data.data
              })
              .finally(() => {
                  gxLoading.value = false
              })
          post('/solution-ppm/api/v2/built-in-system-ppm/project/factory/relation/search', {
              type: '磨',
              projectId: useProjectId.value
          })
              .then(data => {
                  factoryState.relazioneData2 = data.data
              })
              .finally(() => {
                  gxLoading.value = false
              })
      }
      function radioChange() {
          if (factoryState.radioValue === '数据列表') {
              getFactoryData(useProjectId.value)
          } else {
              if (!useProjectId.value) {
                  message.info('请选择一个项目')
                  return
              }
              getGxData()
          }
      }
      function getGroupTask() {
          post('/solution-ppm/api/v2/built-in-system-ppm/delivery_task/search', {
              projectId: useProjectId.value,
              templateTaskType: '全品种专项',
              'taskName': '',
              'endTime': '',
              'taskOwner': '',
              'taskStatusOnOrOff': 'true',
              'taskStatusList': [],
              'stateInput': '',
              'priorityStr': '',
              'milepostId': ''
          }).then(data => {
              factoryState.groupTaskList = data.data
                  .filter(item => item.groupTaskCheck)
                  .map(item => ({
                      label: item.taskName,
                      value: item.taskId
                  }))
          })
      }
      const gxLoading = ref(false)
      function getAllData() {
          getFactoryData()
          getGxData(useProjectId.value)
      }
      // 设置任务
      function confirmSet() {
          factoryState.setLoading = true
          const params = {
              projectId: useProjectId.value,
              kilnMainTaskId: factoryState.yTask1,
              kilnAllTaskId: factoryState.yTask2,
              gridingMillMainTaskId: factoryState.sTask1,
              gridingMillAllTaskId: factoryState.sTask2
          }
          post('/solution-ppm/api/v2/built-in-system-ppm/project/factory/status_config/save', params)
              .then(data => {
                  if (data.code !== 200) {
                      message.error(data.message)
                      return
                  }
                  message.success(data.message)
                  cancelSet()
                  getGxData()
              })
              .finally(() => {
                  factoryState.setLoading = false
              })
      }
      function cancelSet() {
          factoryState.setVisible = false
      }
      function getTaskList() {
          post('/solution-ppm/api/v2/built-in-system-ppm/delivery_task/search', {
              projectId: useProjectId.value,
              templateTaskType: '全品种专项',
              'taskName': '',
              'endTime': '',
              'taskOwner': '',
              'taskStatusOnOrOff': 'true',
              'taskStatusList': [],
              'stateInput': '',
              'priorityStr': '',
              'milepostId': ''
          }).then(data => {
              factoryState.taskList2 = data.data.map(item => ({
                  label: item.taskName,
                  value: item.taskId
              }))
          })
          post('/solution-ppm/api/v2/built-in-system-ppm/delivery_task/search', {
              projectId: useProjectId.value,
              templateTaskType: '主流程',
              'taskName': '',
              'endTime': '',
              'taskOwner': '',
              'taskStatusOnOrOff': 'true',
              'taskStatusList': [],
              'stateInput': '',
              'priorityStr': '',
              'milepostId': ''
          }).then(data => {
              factoryState.taskList1 = data.data.map(item => ({
                  label: item.taskName,
                  value: item.taskId
              }))
          })
      }
      function handleSetTask() {
          get(`/solution-ppm/api/v2/built-in-system-ppm/project/factory/${useProjectId.value}/status_config`).then(
              data => {
                  factoryState.yTask1 = data.data?.kilnMainTaskId || undefined
                  factoryState.yTask2 = data.data?.kilnAllTaskId || undefined
                  factoryState.sTask1 = data.data?.gridingMillMainTaskId || undefined
                  factoryState.sTask2 = data.data?.gridingMillAllTaskId || undefined
                  factoryState.setVisible = true
              }
          )
      }
      //工厂信息
</script>
<style lang="less" scoped>
  .page_root {
  width: 100%;
  height: 100%;
  overflow: auto;
  }
  .page_root :deep(.@{ant-prefix}-spin-nested-loading),
  .page_root :deep(.@{ant-prefix}-spin-container)
   {
      height: 100%;
  }
  .page_root :deep(.@{ant-prefix}-spin-container .@{ant-prefix}-table-wrapper)
   {
      display: flex;
      flex-flow: column nowrap;
      justify-content: flex-start;
  }
  .page_root :deep(.@{ant-prefix}-table)
   {
    flex: auto;
    overflow: auto;
  }
  .table-moreBtn_down {
    overflow: hidden; white-space: nowrap; text-overflow: ellipsis; width: 100px;
  }

  .table-moreBtn_menu :deep(.table-moreBtn_menu-item):hover {
    background: #ebf1ff;
  }

  /*  表格树结构样式处理，展开按钮层级增加*/
  :deep(.@{ant-prefix}-table-row-expand-icon) {
    z-index: 1;
  }
  /*  表格树结构 由于每个表格项采用自定义组件，使用绝对定位布局，开启树结构导致显示异常，暂时使用层级定位位置 */
  :deep(.@{ant-prefix}-table-row-level-1 .@{ant-prefix}-table-cell-with-append .cell-wrapper-left) {
    left: 15px !important;
    width: calc(100% - 15px);
  }
  :deep(.@{ant-prefix}-table-row-level-2 .@{ant-prefix}-table-cell-with-append .cell-wrapper-left) {
    left: 30px !important;
    width: calc(100% - 30px);
  }
  :deep(.@{ant-prefix}-table-row-level-3 .@{ant-prefix}-table-cell-with-append .cell-wrapper-left) {
    left: 45px !important;
    width: calc(100% - 45px);
  }
  :deep(.@{ant-prefix}-table-row-level-4 .@{ant-prefix}-table-cell-with-append .cell-wrapper-left) {
    left: 60px !important;
    width: calc(100% - 60px);
  }

  /* 穿梭框改变默认样式，为根据组件样式控制左右栏宽度。 */
  :deep(.@{ant-prefix}-transfer-list)
   {
      height: 100%;
      width: 50%;
  }
  .vid_9dwjk5bbll{
      padding-top:24px;
      padding-bottom:24px;
      background-color:#FF0707
  }
  .vid_h7skca6kvk{
      box-shadow:0px 0px 0px 0px
  }
  .vid_88rtnv1o7y{
      box-shadow:0px 0px 0px 0px
  }

  /*工厂信息*/
      .factory-body {
          background-color: #fff;
          padding: 24px;
          padding-top: 10px;
      }
      .factory-top {
          display: flex;
          align-items: center;
          justify-content: space-between;
          margin-bottom: 16px;
      }
      .factory-del {
          width: 28px;
          color: #3875ff;
          position: absolute;
          right: 0;
          top: 5px;
      }
      .factory-add-btn {
          position: absolute;
          right: 40px;
          color: #3875ff;
          top: 5px;
      }
      .factory-my-page :deep(.ant3-form-item-label) {
          width: 120px;
      }
      .factory-table {
          margin-bottom: 24px;
      }
      .title-factory {
          font-size: 16px;
          color: #262626;
          letter-spacing: 0;
          font-weight: 600;
          height: 16px;
          line-height: 16px;
          padding-left: 8px;
          border-left: 4px solid #3875ff;
          display: flex;
          justify-content: space-between;
          align-items: center;
      }
      .title-factory:nth-child(n + 2) {
          margin-bottom: 16px;
      }
      .factory-table :deep(.@{ant-prefix}-table-thead) > tr > th {
          background: #3875ff;
          color: #fff;
          font-weight: 600;
          padding: 8px 16px;
          border-right: 1px solid #d9d9d9 !important;
          position: relative;
      }
      .factory-table :deep(.@{ant-prefix}-table-tbody) tr > td {
          font-size: 14px;
          font-family: arial, helvetica, 'microsoft yahei';
          font-weight: 400;
          color: #262626;
          border-bottom: 1px solid #d9d9d9;
          padding: 3px 16px;
          word-break: break-all;
      }
      .factory-form-content {
          display: inline-block;
          width: calc(100% - 80px);
      }
      .factory-del {
          width: 28px;
          color: #3875ff;
          position: absolute;
          right: 0;
          top: 5px;
      }
      .factory-module-item {
          position: relative;
      }
      .factory-add-btn {
          position: absolute;
          right: 40px;
          color: #3875ff;
          top: 5px;
      }
      .factory-my-page :deep(.ant3-form-item-label) {
          width: 80px;
      }
      .y-form :deep(.ant3-form-item-label) {
          width: 100px;
      }
      .top-tip {
          display: flex;
          font-size: 14px;
          color: #262626;
          letter-spacing: 0;
          text-align: justify;
          font-weight: 400;
          background: rgba(250, 173, 20, 0.1);
          border-radius: 2px;
          padding: 6px 16px;
          margin-right: 8px;
          gap: 4px;
          margin-bottom: 16px;
      }
      .tip-img {
          width: 16px;
          height: 16px;
          color: #fcb21b;
          margin-top: 5px;
      }
      .sc-form :deep(.ant3-form-item-label) {
          width: 120px;
      }
      .top-flex {
          display: flex;
          justify-content: space-between;
          margin-bottom: 16px;
          align-items: center;
      }
       :deep(.qian.ant3-btn-background-ghost) {
          background: rgba(56, 117, 255, 0.1);
          border: 1px solid #3875ff;
          border-radius: 2px;
      }
      /*工厂信息*/
</style>